//
//  SPVenueInfoCell.m
//  Sport
//
//  Created by Cass on 2018/3/21.
//  Copyright © 2018年 Cass. All rights reserved.
//

#import "SPVenueInfoCell.h"

@interface SPVenueInfoCell()
@property (weak, nonatomic) IBOutlet UIImageView *venueImg;
@property (weak, nonatomic) IBOutlet UILabel *venueName;
@property (weak, nonatomic) IBOutlet UIButton *venueAdd;
@property (weak, nonatomic) IBOutlet UILabel *venuePrice;
@property (weak, nonatomic) IBOutlet UILabel *venueMark;
@property (weak, nonatomic) IBOutlet UILabel *venueMarkName;

@end

@implementation SPVenueInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)layoutSubviews{
    [super layoutSubviews];
}

- (void)setInfoModel:(SPInfoModel *)infoModel{
    _infoModel = infoModel;
    
    [self.venueImg sd_setImageWithURL:[NSURL URLWithString:infoModel.venuesimage] placeholderImage:[UIImage imageNamed:@"ha"]];
    self.venueImg.layer.cornerRadius = 1.0f;
    self.venueImg.layer.masksToBounds = YES;
    self.venueName.text = infoModel.venuesname;
    [self.venueName sizeToFit];
    [self.venueAdd setTitle:infoModel.venuesadd forState:UIControlStateNormal];
    [self.venueAdd sizeToFit];
    
    self.venueAdd.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    self.venueAdd.contentEdgeInsets = UIEdgeInsetsMake(0,10, 0, 0);
    
    self.venuePrice.text = [NSString stringWithFormat:@"%@元",infoModel.venuesprice];
    self.venuePrice.textColor = [UIColor colorWithRed:251.0/255 green:210.0/255 blue:66.0/255 alpha:1];
    self.venueMark.text = [NSString stringWithFormat:@"%@",infoModel.venuesmark];
    
    [self layoutIfNeeded];
}

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"cell2";
    SPVenueInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[[NSBundle mainBundle]loadNibNamed:NSStringFromClass([SPVenueInfoCell class]) owner:nil options:nil] lastObject];
    }
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
